<%
stat1=Request.QueryString("status")
PCnt=15
ModPCnt=(rs.pagecount mod cint(PCnt))

if Request.QueryString("nom")<>empty then
	if Request.QueryString("nom")<1 then
	page=1
	else
	page=Request.QueryString("nom")
	end if
else
page=1
end if

rs.AbsolutePage = CLng(page)

if rs.pagecount>cint(PCnt) then
	if cint(page)>rs.pagecount then
		page=rs.pagecount
		rs.absolutepage=clng(page)
		FirstP=cint(rs.pagecount)-cint(PCnt)
		LastP=rs.pagecount
		aPrev="<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom=1&date="&MDay&"'>1 </a>&nbsp;<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(rs.pagecount-cint(ModPCnt))&"&date="&MDay&"'>...Prev...</a>"
		aNext=""
	else
		if cint(page)<1 then
			page=1
			FirstP=1
			LastP=cint(PCnt)
			rs.absolutepage=1
			aPrev=""
			aNext="<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(LastP)&"&date="&MDay&"'>...Next...</a>&nbsp;<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(rs.pagecount)&"&date="&MDay&"'>"&rs.pagecount&"</a>"					
		else
			if cint(page)=>(cint(rs.pagecount)-cint(ModPCnt)) then
				FirstP=(cint(rs.pagecount)-cint(ModPCnt))
				LastP=cint(rs.pagecount)
				aPrev="<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom=1&date="&MDay&"'>1 </a>&nbsp;<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(cint(FirstP)-cint(PCnt)+1)&"&date="&MDay&"'>...Prev...</a>"
				aNext=""
			else
				FirstP=(cint(page)-(cint(page) mod cint(PCnt)))
				LastP=FirstP+cint(PCnt)
				aPrev="<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom=1&date="&MDay&"'>1 </a>&nbsp;<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(cint(FirstP)-cint(PCnt))&"&date="&MDay&"'>...Prev...</a>"	
				aNext="<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(LastP)&"&date="&MDay&"'>...Next...</a>&nbsp;<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(rs.pagecount)&"&date="&MDay&"'>"&rs.pagecount&"</a>"
				if 	FirstP<1 then
					FirstP=1
					LastP=cint(PCnt)
					aPrev=""	
					aNext="<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(LastP)&"&date="&MDay&"'>...Next...</a>&nbsp;<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&(rs.pagecount)&"&date="&MDay&"'>"&rs.pagecount&"</a>"
				end if		
				if LastP=>cint(rs.pagecount) then
					FirstP=(cint(rs.pagecount)-cint(ModPCnt))
					LastP=cint(rs.pagecount)
					page=rs.pagecount
					rs.absolutepage=clng(page)
					aPrev="<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom=1&date="&MDay&"'>1</a>&nbsp;<a href='WatchLog.asp?firstinput="&DataS&"&secondinput="&DataPo&"&Direction=Nom&status="&stat1&"&nom="&((cint(FirstP)-cint(PCnt))+strCh)&"&date="&MDay&"'>...Prev...</a>"
					aNext=""
				end if
			end if
		end if
	end if
else
	FirstP=1
	LastP=rs.pagecount
	aPrev="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
	aNext=""
end if

		q=FirstP
		response.write aPrev
	  for q=FirstP to LastP
	  	if q<>cint(page) then%>
		<a href="WatchLog.asp?firstinput=<%=DataS%>&secondinput=<%=DataPo%>&Direction=Nom&status=<%=stat1%>&nom=<%=q%>&date=<%=MDay%>"><%=q%></a>
		<% 		
		else
		response.write "&nbsp;<font color=#660000><b>["&q&"]</b></Font>&nbsp;"
		end if
	  Next
		response.write aNext
%>



